from django.db import models

# Create your models here.

class UsersList(models.Model):
  user_email = models.CharField(max_length=50,unique=True,null=False,\
                                db_index=True)
  password = models.CharField(max_length=255, null=True)
  phone = models.SmallIntegerField(null=True)
  is_super = models.SmallIntegerField(null=True, choices=[('0','普通'), ('1', '管理')], default=0)
  uuid = models.CharField(max_length=255, null=True,unique=True)

class DomainList(models.Model):
  domain_name = models.CharField(max_length=255, unique=True, db_index=True)
  domain_info = models.CharField(max_length=500, null=True)
  transaction_type = models.SmallIntegerField(null=True,default=2)
  domain_type = models.CharField(max_length=255, null=True)
  status = models.SmallIntegerField(null=True, choices=[('0','未出售'), ('1', '已出售')], default=0)

class UserInfo(models.Model):
  user_email = models.CharField(max_length=50,unique=True,null=True)
  purchased = models.CharField(max_length=500,null=True )
  email_uuid = models.ForeignKey(to='UsersList', to_field='uuid')

class Registered(models.Model):
  domain_name = models.CharField(max_length=50,unique=True,null=False,\
                                db_index=True, primary_key=True)
  registered_info = models.CharField(max_length=500, null=True)
  base_totle = models.SmallIntegerField(null=True, default=0)
  base_price = models.SmallIntegerField(null=True, default=0)
  status = models.SmallIntegerField(null=True, default=0)

class Reserve(models.Model):
  domain_name = models.CharField(max_length=50,unique=True,null=False,\
                                db_index=True, primary_key=True)
  user_email = models.CharField(max_length=50,null=True)
  user_tel = models.SmallIntegerField(null=True)
  order_number = models.CharField(max_length=255, null=True)
  transaction_time = models.CharField(max_length=50, null=True)
  transaction_price = models.CharField(max_length=50, null=True)


